import Mock from 'mockjs'


const userList = [{
	username: 'admin',
	password: 'admin'
},
{
	username: '123',
	password: '123'
}]

Mock.mock('/api/login', 'post', req => {
	const { username, password } = JSON.parse(req.body)
	const isExist = userList.some(v => v.username === username && v.password === password)
	if(isExist) {
		return {
			code: 200,
			data: null,
			token: username
		}
	} else {
		return {
			code: 403,
			data: null,
			mess: '账户密码错误！！！'
		}
	}
})



Mock.mock('/api/list', {
	"code": '200',
	'data|10': [{
		"url": '@image(100x100, @color)',
		'title': '@ctitle',
		'id': '@id',
		'desc': '@cword(20, 30)'
	}]
})

